﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq.Mapping;
using System.Runtime.Serialization;

namespace MobiMenu.Restaurant
{
    [Table(Name = "Orders")]
    [DataContract(Namespace = "MobiMenu.Restaurant")]
    public class Order
    {
        private DateTime _orderedTime;
        [Column(Storage = "_orderedTime")]
        [DataMember(Name = "orderedTime")]
        public DateTime OrderedTime
        {
            get
            {
                return _orderedTime;
            }
            set
            {
                _orderedTime = value;
            }
        }

        private string _waiterId;
        [Column(Storage = "_waiterId")]
        [DataMember(Name = "waiterId")]
        public string WaiterId
        {
            get
            {
                return _waiterId;
            }
            set
            {
                _waiterId = value;
            }
        }

        private string _tableId;
        [Column(Storage = "_tableId")]
        [DataMember(Name = "tableId")]
        public string TableId
        {
            get
            {
                return _tableId;
            }
            set
            {
                _tableId = value;
            }
        }

        private IList<OrderedDish> _orderedDishes;

        public IList<OrderedDish> OrderedDishes
        {
            get 
            {
                if (_orderedDishes == null)
                {
                    _orderedDishes = new List<OrderedDish>();
                }

                return _orderedDishes; 
            }
        }

        private OrderStatus _status;
        [Column(Storage = "_status")]
        [DataMember(Name = "status")]
        public OrderStatus Status
        {
            get
            {
                return _status;
            }
            set
            {
                _status = value;
            }
        }


        private int _id;
        [Column(IsPrimaryKey = true, Storage = "_id", IsDbGenerated = true)]
        [DataMember(Name = "id")]
        public int Id
        {
            get
            {
                return _id;
            }
            set
            {
                _id = value;
            }
        }
    }
}
